/********************************************************/
/*	Copyright (C) 2016 Gong Li Bin		 	*/
/*	Project:	GoLib-1.0.0			*/
/*	Author:		gong_libin			*/
/*	Date:		2016_01_01			*/
/*	File:		GoPbTest.go			*/
/********************************************************/

// go get github.com/golang/protobuf

package main

import (
	. "GoGlb"
	P "GoPro"
)

func main() {
	src := &P.GoPtb {
		Name: P.GoPbString("ptb"),
		Addr: P.GoPbString("pingtuibao"),
		Tele: P.GoPbString("+8610 85562600"),
		Mail: P.GoPbString("www.pingtuibao.cn"),
	}
	if pkg, err := P.GoPbMarshal(src); nil == err {
		GoPrtHx(0, len(pkg), pkg)
		dst := &P.GoPtb {}
		if nil == P.GoPbUnmarshal(pkg, dst) {
			GoPrint("Name: %s\n", dst.GetName())
			GoPrint("Addr: %s\n", dst.GetAddr())
			GoPrint("Tele: %s\n", dst.GetTele())
			GoPrint("Mail: %s\n", dst.GetMail())
		} else {
			GoPrint("Failed to GoPbUnmarshal\n")
		}
	} else {
		GoPrint("Failed to GoPbMarshal\n")
	}
}
